<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>CentOS 7 搭建 LNMP 环境 | AiKIKI</title><meta name="author" content="樵子"><meta name="copyright" content="樵子"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="referrer" content="no-referrer"><meta name="description" content="安装 Nginx更新系统安装任何组件之前，养成更新系统的好习惯。 1yum -y update  安装 Nginx安装 Nginx 源CentOS 默认源没有集成 Nginx，我们需要先安装 Nginx 源。 1yum localinstall http:&#x2F;&#x2F;nginx.org&#x2F;packages&#x2F;centos&#x2F;7&#x2F;noarch&#x2F;RPMS&#x2F;nginx-release-centos-7-0.el7.n">
<meta property="og:type" content="article">
<meta property="og:title" content="CentOS 7 搭建 LNMP 环境">
<meta property="og:url" content="https://www.aikiki.top/post/52e3/index.html">
<meta property="og:site_name" content="AiKIKI">
<meta property="og:description" content="安装 Nginx更新系统安装任何组件之前，养成更新系统的好习惯。 1yum -y update  安装 Nginx安装 Nginx 源CentOS 默认源没有集成 Nginx，我们需要先安装 Nginx 源。 1yum localinstall http:&#x2F;&#x2F;nginx.org&#x2F;packages&#x2F;centos&#x2F;7&#x2F;noarch&#x2F;RPMS&#x2F;nginx-release-centos-7-0.el7.n">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif">
<meta property="article:published_time" content="2019-05-25T22:39:00.000Z">
<meta property="article:modified_time" content="2023-11-16T08:35:48.000Z">
<meta property="article:author" content="樵子">
<meta property="article:tag" content="CentOS">
<meta property="article:tag" content="MariaDB">
<meta property="article:tag" content="PHP">
<meta property="article:tag" content="phpMyAdmin">
<meta property="article:tag" content="Nginx">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/favicon.ico"><link rel="canonical" href="https://www.aikiki.top/post/52e3/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'CentOS 7 搭建 LNMP 环境',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-11-16 16:35:48'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/atom.xml" title="AiKIKI" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif')"><nav id="nav"><span id="blog-info"><a href="/" title="AiKIKI"><span class="site-name">AiKIKI</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">CentOS 7 搭建 LNMP 环境</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-05-25T22:39:00.000Z" title="发表于 2019-05-26 06:39:00">2019-05-26</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-11-16T08:35:48.000Z" title="更新于 2023-11-16 16:35:48">2023-11-16</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Archives/">Archives</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.3k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>10分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="CentOS 7 搭建 LNMP 环境"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="安装-Nginx"><a href="#安装-Nginx" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h1><h2 id="更新系统"><a href="#更新系统" class="headerlink" title="更新系统"></a>更新系统</h2><p>安装任何组件之前，养成更新系统的好习惯。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum -y update</span><br></pre></td></tr></table></figure>

<h2 id="安装-Nginx-1"><a href="#安装-Nginx-1" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h2><h3 id="安装-Nginx-源"><a href="#安装-Nginx-源" class="headerlink" title="安装 Nginx 源"></a>安装 Nginx 源</h3><p>CentOS 默认源没有集成 Nginx，我们需要先安装 Nginx 源。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm -y</span><br></pre></td></tr></table></figure>

<h3 id="安装-nginx"><a href="#安装-nginx" class="headerlink" title="安装 nginx"></a>安装 nginx</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y nginx</span><br></pre></td></tr></table></figure>

<h3 id="启动-nginx"><a href="#启动-nginx" class="headerlink" title="启动 nginx"></a>启动 nginx</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl start nginx</span><br></pre></td></tr></table></figure>

<h2 id="配置系统防火墙"><a href="#配置系统防火墙" class="headerlink" title="配置系统防火墙"></a>配置系统防火墙</h2><h3 id="修改接口区域并查看已开放的端口"><a href="#修改接口区域并查看已开放的端口" class="headerlink" title="修改接口区域并查看已开放的端口"></a>修改接口区域并查看已开放的端口</h3><blockquote>
<p><code>block</code> 区域不开放任何端口,设置好需要重载一下配置。后续操作，请注意区域设置。</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 将接口添加到区域，默认接口都在public。</span></span><br><span class="line">firewall-cmd --zone=block --add-interface=eth0 --permanent</span><br><span class="line"></span><br><span class="line"><span class="comment"># 更新防火墙规则</span></span><br><span class="line">firewall-cmd --reload</span><br></pre></td></tr></table></figure>

<p>查看端口：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --list-ports</span><br></pre></td></tr></table></figure>

<h3 id="开启-80-端口"><a href="#开启-80-端口" class="headerlink" title="开启 80 端口"></a>开启 80 端口</h3><blockquote>
<p>命令：firewall-cmd –zone&#x3D;作用域 –add-port&#x3D;端口和访问类型 –permanent(永久生效，缺省该参数为临时生效。)</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --zone=public --add-port=80/tcp --permanent</span><br></pre></td></tr></table></figure>

<h3 id="重启防火墙"><a href="#重启防火墙" class="headerlink" title="重启防火墙"></a>重启防火墙</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --reload</span><br></pre></td></tr></table></figure>

<p>重启防火墙后，使用前面查看已开放的端口可以看见 80 端口已经开启。</p>
<h3 id="附：防火墙常用操作指令"><a href="#附：防火墙常用操作指令" class="headerlink" title="附：防火墙常用操作指令"></a>附：防火墙常用操作指令</h3><p>1)、停止防火墙。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop firewalld.service</span><br></pre></td></tr></table></figure>

<p>2)、禁止防火墙开机启动。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl <span class="built_in">disable</span> firewalld.service</span><br></pre></td></tr></table></figure>

<p>3)、删除开启的端口。</p>
<blockquote>
<p>命令：firewall-cmd –zone&#x3D;作用域 –remove-port&#x3D;端口和访问类型 –permanent(永久生效，缺省该参数为临时生效。)</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --zone=public --remove-port=80/tcp --permanent</span><br></pre></td></tr></table></figure>

<p>4)、指定 IP 与端口。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --permanent --add-rich-rule=<span class="string">&quot;rule family=&quot;</span>ipv4<span class="string">&quot; source address=&quot;</span>192.168.8.2<span class="string">&quot; port protocol=&quot;</span>tcp<span class="string">&quot; port=&quot;</span>22<span class="string">&quot; accept&quot;</span></span><br></pre></td></tr></table></figure>

<p>5)、指定 ip 段可以访问</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --permanent --add-rich-rule=<span class="string">&quot;rule family=&quot;</span>ipv4<span class="string">&quot; source address=&quot;</span>192.168.8.0/24<span class="string">&quot; port protocol=&quot;</span>tcp<span class="string">&quot; port=&quot;</span>22<span class="string">&quot; accept&quot;</span></span><br></pre></td></tr></table></figure>

<p>6)、指定 ip 地址开放所有端口</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --permanent --add-rich-rule=<span class="string">&quot;rule family=&quot;</span>ipv4<span class="string">&quot; source address=&quot;</span>192.168.8.8<span class="string">&quot; port protocol=&quot;</span>tcp<span class="string">&quot; port=&quot;</span>0-65535<span class="string">&quot; accept&quot;</span></span><br></pre></td></tr></table></figure>

<p>7)、查看配置结果</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --list-all</span><br></pre></td></tr></table></figure>

<p>8)、删除规则</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">firewall-cmd --permanent --remove-rich-rule=<span class="string">&quot;rule family=&quot;</span>ipv4<span class="string">&quot; source address=&quot;</span>192.168.8.2<span class="string">&quot; port protocol=&quot;</span>tcp<span class="string">&quot; port=&quot;</span>22<span class="string">&quot; accept&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="测试-Nginx"><a href="#测试-Nginx" class="headerlink" title="测试 Nginx"></a>测试 Nginx</h2><p>本机输入：<code>http://127.0.0.1/</code> 或者远程访问服务器 IP 地址 <code>http://服务器 IP 地址/</code>，可以看见以下界面：</p>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/2529785994.png" alt="2529785994.png"></p>
<h1 id="安装-MariaDB-数据库"><a href="#安装-MariaDB-数据库" class="headerlink" title="安装 MariaDB 数据库"></a>安装 MariaDB 数据库</h1><p>参见：</p>
<blockquote>
<p><a target="_blank" rel="noopener" href="https://typecho.aikiki.top:6443/typecho/archives/CentOS-7-%E6%90%AD%E5%BB%BA-LAMP-%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85-WordPress.html">《CentOS 7 搭建 LAMP 环境安装 WordPress》 一文中的数据库安装</a></p>
</blockquote>
<h1 id="安装-PHP"><a href="#安装-PHP" class="headerlink" title="安装 PHP"></a>安装 PHP</h1><h2 id="安装-PHP-1"><a href="#安装-PHP-1" class="headerlink" title="安装 PHP"></a>安装 PHP</h2><h3 id="安装-PHP-2"><a href="#安装-PHP-2" class="headerlink" title="安装 PHP"></a>安装 PHP</h3><p>参见：</p>
<blockquote>
<p><a target="_blank" rel="noopener" href="https://typecho.aikiki.top:6443/typecho/archives/CentOS-7-%E6%90%AD%E5%BB%BA-LAMP-%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85-WordPress.html">《CentOS 7 搭建 LAMP 环境安装 WordPress》 一文中的 PHP 安装</a></p>
</blockquote>
<p>上文安装的 PHP 是 5.6 版本。本次环境搭建采用 7.2 版本，在安装的时候指定安装 72 版本（将 <code>56</code> 换成 <code>72</code> 即可）。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install -y php72w php72w-opcache php72w-xml php72w-mcrypt php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring</span><br></pre></td></tr></table></figure>

<h3 id="设置-Session-文件夹权限"><a href="#设置-Session-文件夹权限" class="headerlink" title="设置 Session 文件夹权限"></a>设置 Session 文件夹权限</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/php.ini</span><br></pre></td></tr></table></figure>

<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">;该行是否注释掉。如果已注释把前面的 ; 去掉。</span><br><span class="line">session.save_path = “/<span class="keyword">var</span>/lib/php/session”</span><br></pre></td></tr></table></figure>

<p>PHP 7.2 <code>session.save_path</code> 默认设置为 <code>/var/lib/php/session</code>，如不修改该文件夹可以忽略以上两步，直接设置文件夹权限即可。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 设置 session 目录权限</span></span><br><span class="line"><span class="built_in">chown</span> -R nginx:nginx /var/lib/php/session/.</span><br></pre></td></tr></table></figure>

<h2 id="安装-php-fpm"><a href="#安装-php-fpm" class="headerlink" title="安装 php-fpm"></a>安装 php-fpm</h2><h3 id="安装-php-fpm-1"><a href="#安装-php-fpm-1" class="headerlink" title="安装 php-fpm"></a>安装 php-fpm</h3><p>Nginx 支持 php 解析需要安装 php-fpm。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install php72w-fpm</span><br></pre></td></tr></table></figure>

<h3 id="配置-php-fpm"><a href="#配置-php-fpm" class="headerlink" title="配置 php-fpm"></a>配置 php-fpm</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nano /etc/php-fpm.d/www.conf</span><br></pre></td></tr></table></figure>

<p>将</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">user</span> <span class="string">=</span> <span class="string">apache</span></span><br><span class="line"><span class="string">group</span> <span class="string">=</span> <span class="string">apache</span></span><br></pre></td></tr></table></figure>

<p>修改为</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">user</span> <span class="string">=</span> <span class="string">nginx</span></span><br><span class="line"><span class="string">group</span> <span class="string">=</span> <span class="string">nginx</span></span><br></pre></td></tr></table></figure>

<h3 id="启动-php-fpm-和设置开机自启动"><a href="#启动-php-fpm-和设置开机自启动" class="headerlink" title="启动 php-fpm 和设置开机自启动"></a>启动 php-fpm 和设置开机自启动</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl start php-fpm</span><br><span class="line">systemctl <span class="built_in">enable</span> php-fpm</span><br></pre></td></tr></table></figure>

<h2 id="配置-Nginx-支持-PHP"><a href="#配置-Nginx-支持-PHP" class="headerlink" title="配置 Nginx 支持 PHP"></a>配置 Nginx 支持 PHP</h2><p>编辑 Nginx 的配置文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nano /etc/nginx/conf.d/default.conf</span><br></pre></td></tr></table></figure>

<p>修改以下代码，加入 <code>index.php</code> 默认页配置：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">location</span> <span class="string">/</span> &#123;</span><br><span class="line">    <span class="string">root</span>   <span class="string">/usr/share/nginx/html;</span></span><br><span class="line">    <span class="string">index</span>  <span class="string">index.php</span> <span class="string">index.html</span> <span class="string">index.htm;</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>将以下代码前面的注释去掉：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#location ~ \.php$ &#123;</span></span><br><span class="line"><span class="comment">#    root           html;</span></span><br><span class="line"><span class="comment">#    fastcgi_pass   127.0.0.1:9000;</span></span><br><span class="line"><span class="comment">#    fastcgi_index  index.php;</span></span><br><span class="line"><span class="comment">#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;</span></span><br><span class="line"><span class="comment">#    include        fastcgi_params;</span></span><br><span class="line"><span class="comment">#&#125;</span></span><br></pre></td></tr></table></figure>

<p>并修改为：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">location</span> <span class="string">~</span> <span class="string">\.php$</span> &#123;</span><br><span class="line">        <span class="comment"># 指定 root 正确路径，否则会出现 404 错误</span></span><br><span class="line">        <span class="string">root</span> <span class="string">/usr/share/nginx/html;</span></span><br><span class="line">        <span class="comment"># 调用 fastcgi 之前检查 404 错误</span></span><br><span class="line">        <span class="string">try_files</span> <span class="string">$uri</span> <span class="string">=404;</span></span><br><span class="line">        <span class="string">fastcgi_pass</span>   <span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span><span class="string">:9000;</span></span><br><span class="line">        <span class="string">fastcgi_index</span>  <span class="string">index.php;</span></span><br><span class="line">        <span class="comment"># 修改 /scripts 为 $document_root，否则 fastcgi 会返回找不到文件的提示</span></span><br><span class="line">        <span class="string">fastcgi_param</span>  <span class="string">SCRIPT_FILENAME</span>  <span class="string">$document_root$fastcgi_script_name;</span></span><br><span class="line">        <span class="string">include</span>        <span class="string">fastcgi_params;</span></span><br><span class="line">     &#125;</span><br></pre></td></tr></table></figure>

<p>Nginx 和 PHP-FPM 的进程间通信有两种方式,一种是 TCP，一种是 UNIX Domain Socket。<br>其中 TCP 是 IP 加端口，可以跨服务器。而 UNIX Domain Socket 不经过网络，只能用于 Nginx 跟 PHP-FPM 都在同一服务器的场景。<br>用哪种取决于你的 PHP-FPM 配置:</p>
<p>方式 1:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 打开 php-fpm 配置文件</span></span><br><span class="line">vim /etc/php-fpm.d/www.conf</span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改 listen</span></span><br><span class="line">listen = 127.0.0.1:9000</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># 打开 nginx 配置文件</span><br><span class="line">vim /etc/nginx/nginx.conf</span><br><span class="line"></span><br><span class="line"># 修改 fastcgi_pass</span><br><span class="line">fastcgi_pass 127.0.0.1:9000;</span><br></pre></td></tr></table></figure>

<p>方式 2:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 打开 php-fpm 配置文件</span></span><br><span class="line">vim /etc/php-fpm.d/www.conf</span><br><span class="line"></span><br><span class="line"><span class="comment"># 修改 listen</span></span><br><span class="line">listen = /var/run/php-fpm/php-fpm.sock</span><br><span class="line"></span><br><span class="line"><span class="comment"># 取消 listen.mode 注释，默认为 0660，修改为 0666。</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 否则会因权限问题无法访问 php-fpm.sock 文件。</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># nobody 用户权限可以忽略此步。</span></span><br><span class="line">listen.mode = 0666</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># 打开 nginx 配置文件</span><br><span class="line">vim /etc/nginx/nginx.conf</span><br><span class="line"></span><br><span class="line"># 修改 fastcgi_pass</span><br><span class="line">fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;</span><br></pre></td></tr></table></figure>

<p>其中 php-fpm.sock 是一个文件，由 php-fpm 生成，默认类型是 srw-rw—-，修改 listen.mode &#x3D; 0666 之后，类型是 srw-rw-rw-。</p>
<h2 id="测试-PHP"><a href="#测试-PHP" class="headerlink" title="测试 PHP"></a>测试 PHP</h2><p>在 <code>/usr/share/nginx/html</code> 文件夹创建测试文件 info.php:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nano /usr/share/nginx/html/info.php</span><br></pre></td></tr></table></figure>

<p>输入测试代码：</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?php</span> <span class="title function_ invoke__">phpinfo</span>(); <span class="meta">?&gt;</span></span><br></pre></td></tr></table></figure>

<p>本机输入：<code>http://127.0.0.1/info.php</code> 或者远程访问服务器 IP 地址 <code>http://服务器 IP 地址/info.php</code>，可以看见以下界面：</p>
<p><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3898761865.png" alt="3898761865.png"></p>
<h1 id="安装-phpMyAdmin"><a href="#安装-phpMyAdmin" class="headerlink" title="安装 phpMyAdmin"></a>安装 phpMyAdmin</h1><p>CentOS 默认源自带的 phpMyAdmin 不支持 php7.2, 如果直接安装，会提示以下安装错误。我们需要手动安装 phpMyAdmin。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">错误：php72w-common conflicts with php-common-5.4.16-46.el7.x86_64</span><br><span class="line"></span><br><span class="line">您可以尝试添加 --skip-broken 选项来解决该问题</span><br><span class="line"></span><br><span class="line">您可以尝试执行：rpm -Va --nofiles --nodigest</span><br></pre></td></tr></table></figure>

<h2 id="下载和安装-phpMyAdmin"><a href="#下载和安装-phpMyAdmin" class="headerlink" title="下载和安装 phpMyAdmin"></a>下载和安装 phpMyAdmin</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入 nginx 根目录</span></span><br><span class="line"><span class="built_in">cd</span> /usr/share/nginx/html</span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载 phpMyAdmin 压缩文件</span></span><br><span class="line">wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz -O phpMyAdmin.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 解压缩</span></span><br><span class="line">tar xzvf phpMyAdmin.tar.gz</span><br><span class="line"></span><br><span class="line"><span class="comment"># 重命名文件夹，源文件夹名称请根据实际情况修改</span></span><br><span class="line"><span class="built_in">mv</span> phpMyAdmin-4.8.5-all-languages phpMyAdmin</span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除压缩文件</span></span><br><span class="line"><span class="built_in">rm</span> phpMyAdmin.tar.gz</span><br></pre></td></tr></table></figure>

<h2 id="访问-phpMyAdmin"><a href="#访问-phpMyAdmin" class="headerlink" title="访问 phpMyAdmin"></a>访问 phpMyAdmin</h2><p>在浏览器输入 <a href="%22http://127.0.0.1/phpMyAdmin">http://127.0.0.1/phpMyAdmin</a> 登录 phpMyAdmin：</p>
<p><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3644091757.png"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/post/img/3644091757.png" alt="3644091757.png"></a></p>
<h2 id="配置-cfg-‘TempDir’-权限"><a href="#配置-cfg-‘TempDir’-权限" class="headerlink" title="配置 $cfg[‘TempDir’] 权限"></a>配置 $cfg[‘TempDir’] 权限</h2><p>phpMyAdmin 为了提高性能需要写入临时文件，否则系统会出现提示 <code>变量 $cfg[&#39;TempDir&#39;] （./tmp/）无法访问。phpMyAdmin无法缓存模板文件，所以会运行缓慢。</code>，可以进行以下配置去掉该提示信息。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入 phpMyAdmin 安装目录</span></span><br><span class="line"><span class="built_in">cd</span> /usr/share/nginx/html/phpMyAdmin</span><br><span class="line"></span><br><span class="line"><span class="comment"># 新建文件夹 tmp</span></span><br><span class="line"><span class="built_in">mkdir</span> tmp</span><br><span class="line"></span><br><span class="line"><span class="comment"># 设置文件夹权限</span></span><br><span class="line"><span class="built_in">chown</span> -R nginx:nginx tmp</span><br><span class="line"><span class="built_in">chmod</span> -R 700 tmp</span><br></pre></td></tr></table></figure>

<h2 id="设置-Cookie-身份验证加密密码"><a href="#设置-Cookie-身份验证加密密码" class="headerlink" title="设置 Cookie 身份验证加密密码"></a>设置 Cookie 身份验证加密密码</h2><p>phpMyAdmin 加强了密码认证，需要设置一个身份验证加密密码。否则系统首页会提示 <code>配置文件现在需要一个短语密码。</code>，如果不想看见该提示可以进行以下设置。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建 phpMyAdmin 配置文件：</span></span><br><span class="line"><span class="built_in">cp</span> config.sample.inc.php config.inc.php</span><br><span class="line"></span><br><span class="line"><span class="comment"># 编辑配置文件</span></span><br><span class="line">vim config.inc.php</span><br></pre></td></tr></table></figure>

<p>查找以下代码，设置 32 位长度的加密密码。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$</span><span class="language-bash">cfg[<span class="string">&#x27;blowfish_secret&#x27;</span>] = <span class="string">&#x27;abcdefghijklmnopqrstuvwxyz123456&#x27;</span>;</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>点击 <a target="_blank" rel="noopener" href="https://passgen.co/?pw=32&sy=0">这里</a> 生成 32 位长度密码。</p>
</blockquote>
<h2 id="开启-phpMyAdmin-高级功能"><a href="#开启-phpMyAdmin-高级功能" class="headerlink" title="开启 phpMyAdmin 高级功能"></a>开启 phpMyAdmin 高级功能</h2><p>phpMyAdmin 首页会提示 <code>phpMyAdmin 高级功能尚未完全设置，部分功能未激活。</code>，点击后面的 <a target="_blank" rel="noopener" href="http://127.0.0.1/phpMyAdmin/chk_rel.php">查找原因</a> 进入下一个页面。</p>
<p>系统提示<code>创建一个名为&#39;phpmyadmin&#39;的数据库，并在那里设置phpMyAdmin配置存储。</code>，点击前面的<a target="_blank" rel="noopener" href="http://127.0.0.1/phpMyAdmin/chk_rel.php">创建</a>来新建 phpmyadmin 数据库。</p>
<p>此时，phpMyAdmin 首页不再提示高级功能尚未完全设置。但高级功能还是未开启，还需要配置 <code>config.inc.php</code> 启用设置。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /usr/share/nginx/html/phpMyAdmin/config.inc.php</span><br></pre></td></tr></table></figure>

<p>将以下代码前面的注释 <code>//</code> 取消即可。</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* Storage database and tables */</span></span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;pmadb&#x27;</span>] = <span class="string">&#x27;phpmyadmin&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;bookmarktable&#x27;</span>] = <span class="string">&#x27;pma__bookmark&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;relation&#x27;</span>] = <span class="string">&#x27;pma__relation&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;table_info&#x27;</span>] = <span class="string">&#x27;pma__table_info&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;table_coords&#x27;</span>] = <span class="string">&#x27;pma__table_coords&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;pdf_pages&#x27;</span>] = <span class="string">&#x27;pma__pdf_pages&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;column_info&#x27;</span>] = <span class="string">&#x27;pma__column_info&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;history&#x27;</span>] = <span class="string">&#x27;pma__history&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;table_uiprefs&#x27;</span>] = <span class="string">&#x27;pma__table_uiprefs&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;tracking&#x27;</span>] = <span class="string">&#x27;pma__tracking&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;userconfig&#x27;</span>] = <span class="string">&#x27;pma__userconfig&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;recent&#x27;</span>] = <span class="string">&#x27;pma__recent&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;favorite&#x27;</span>] = <span class="string">&#x27;pma__favorite&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;users&#x27;</span>] = <span class="string">&#x27;pma__users&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;usergroups&#x27;</span>] = <span class="string">&#x27;pma__usergroups&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;navigationhiding&#x27;</span>] = <span class="string">&#x27;pma__navigationhiding&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;savedsearches&#x27;</span>] = <span class="string">&#x27;pma__savedsearches&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;central_columns&#x27;</span>] = <span class="string">&#x27;pma__central_columns&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;designer_settings&#x27;</span>] = <span class="string">&#x27;pma__designer_settings&#x27;</span>;</span><br><span class="line"><span class="variable">$cfg</span>[<span class="string">&#x27;Servers&#x27;</span>][<span class="variable">$i</span>][<span class="string">&#x27;export_templates&#x27;</span>] = <span class="string">&#x27;pma__export_templates&#x27;</span>;</span><br></pre></td></tr></table></figure>

<h1 id="Nginx-和-php-fpm-的用户和用户组"><a href="#Nginx-和-php-fpm-的用户和用户组" class="headerlink" title="Nginx 和 php-fpm 的用户和用户组"></a>Nginx 和 php-fpm 的用户和用户组</h1><h2 id="修改用户和用户组"><a href="#修改用户和用户组" class="headerlink" title="修改用户和用户组"></a>修改用户和用户组</h2><p>nginx 用户和用户组配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/nginx/nginx.conf</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"># 默认用户名是 nginx，如需指定用户组格式为：user username usergroup</span><br><span class="line">user nginx nginx</span><br></pre></td></tr></table></figure>

<p>php-fpm 用户和用户组配置文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/php-fpm.d/www.conf</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">// 默认用户和用户组是 apache</span><br><span class="line">user = nginx</span><br><span class="line">group = nginx</span><br></pre></td></tr></table></figure>

<h2 id="修改目录权限"><a href="#修改目录权限" class="headerlink" title="修改目录权限"></a>修改目录权限</h2><p>如果变更了用户或用户组，还需要修改以下目录权限。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># nginx的日志目录 /var/log/nginx</span></span><br><span class="line"><span class="built_in">chown</span> -R nginx:nginx /var/log/nginx     </span><br><span class="line"></span><br><span class="line"><span class="comment"># 上传文件临时目录 /var/lib/nginx/tmp/</span></span><br><span class="line"><span class="built_in">chown</span> -R nginx:nginx /var/lib/nginx  </span><br><span class="line"></span><br><span class="line"><span class="comment"># php session 保存目录：php_value[session.save_path] = /var/lib/php/session</span></span><br><span class="line"><span class="built_in">chown</span> -R nginx:nginx /var/lib/php/session</span><br></pre></td></tr></table></figure>

<blockquote>
<p>生产环境建议设置为 nobody，需要写入的权限通过指令<code>chmod -R 777 目录名</code>修改。</p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://www.aikiki.top">樵子</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://www.aikiki.top/post/52e3/">https://www.aikiki.top/post/52e3/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.aikiki.top" target="_blank">AiKIKI</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/CentOS/">CentOS</a><a class="post-meta__tags" href="/tags/MariaDB/">MariaDB</a><a class="post-meta__tags" href="/tags/PHP/">PHP</a><a class="post-meta__tags" href="/tags/phpMyAdmin/">phpMyAdmin</a><a class="post-meta__tags" href="/tags/Nginx/">Nginx</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/post/1952/" title="谷歌云 Compute Engine 安装 CentOS 7 总结"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">谷歌云 Compute Engine 安装 CentOS 7 总结</div></div></a></div><div class="next-post pull-right"><a href="/post/e4e5/" title="CentOS 7 搭建 LAMP 环境安装 WordPress"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">CentOS 7 搭建 LAMP 环境安装 WordPress</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/post/e4e5/" title="CentOS 7 搭建 LAMP 环境安装 WordPress"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-05-10</div><div class="title">CentOS 7 搭建 LAMP 环境安装 WordPress</div></div></a></div><div><a href="/post/6f9d/" title="Docker 搭建 DNMP 环境"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-03-22</div><div class="title">Docker 搭建 DNMP 环境</div></div></a></div><div><a href="/post/1952/" title="谷歌云 Compute Engine 安装 CentOS 7 总结"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-05-28</div><div class="title">谷歌云 Compute Engine 安装 CentOS 7 总结</div></div></a></div><div><a href="/post/dab6/" title="使用 Windows 自带的远程桌面 mstsc 连接 CentOS 7"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-06-20</div><div class="title">使用 Windows 自带的远程桌面 mstsc 连接 CentOS 7</div></div></a></div><div><a href="/post/a3e5/" title="CentOS 7 清理开机启动项"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-03-14</div><div class="title">CentOS 7 清理开机启动项</div></div></a></div><div><a href="/post/def6/" title="使用 Windows 自带的远程桌面 mstsc 连接 CentOS 8"><img class="cover" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-09</div><div class="title">使用 Windows 自带的远程桌面 mstsc 连接 CentOS 8</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">樵子</div><div class="author-info__description">Always CREATIVE.</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/acmeist"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/acmeist" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:huweighost@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="Rss"><i class="fas fa-rss"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">感謝訪問本站，若喜歡請收藏 ^_^</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-Nginx"><span class="toc-number">1.</span> <span class="toc-text">安装 Nginx</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9B%B4%E6%96%B0%E7%B3%BB%E7%BB%9F"><span class="toc-number">1.1.</span> <span class="toc-text">更新系统</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-Nginx-1"><span class="toc-number">1.2.</span> <span class="toc-text">安装 Nginx</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-Nginx-%E6%BA%90"><span class="toc-number">1.2.1.</span> <span class="toc-text">安装 Nginx 源</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-nginx"><span class="toc-number">1.2.2.</span> <span class="toc-text">安装 nginx</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8-nginx"><span class="toc-number">1.2.3.</span> <span class="toc-text">启动 nginx</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E7%B3%BB%E7%BB%9F%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-number">1.3.</span> <span class="toc-text">配置系统防火墙</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E6%8E%A5%E5%8F%A3%E5%8C%BA%E5%9F%9F%E5%B9%B6%E6%9F%A5%E7%9C%8B%E5%B7%B2%E5%BC%80%E6%94%BE%E7%9A%84%E7%AB%AF%E5%8F%A3"><span class="toc-number">1.3.1.</span> <span class="toc-text">修改接口区域并查看已开放的端口</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BC%80%E5%90%AF-80-%E7%AB%AF%E5%8F%A3"><span class="toc-number">1.3.2.</span> <span class="toc-text">开启 80 端口</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%87%8D%E5%90%AF%E9%98%B2%E7%81%AB%E5%A2%99"><span class="toc-number">1.3.3.</span> <span class="toc-text">重启防火墙</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%99%84%EF%BC%9A%E9%98%B2%E7%81%AB%E5%A2%99%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C%E6%8C%87%E4%BB%A4"><span class="toc-number">1.3.4.</span> <span class="toc-text">附：防火墙常用操作指令</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95-Nginx"><span class="toc-number">1.4.</span> <span class="toc-text">测试 Nginx</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-MariaDB-%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">2.</span> <span class="toc-text">安装 MariaDB 数据库</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-PHP"><span class="toc-number">3.</span> <span class="toc-text">安装 PHP</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-PHP-1"><span class="toc-number">3.1.</span> <span class="toc-text">安装 PHP</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-PHP-2"><span class="toc-number">3.1.1.</span> <span class="toc-text">安装 PHP</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE-Session-%E6%96%87%E4%BB%B6%E5%A4%B9%E6%9D%83%E9%99%90"><span class="toc-number">3.1.2.</span> <span class="toc-text">设置 Session 文件夹权限</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-php-fpm"><span class="toc-number">3.2.</span> <span class="toc-text">安装 php-fpm</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-php-fpm-1"><span class="toc-number">3.2.1.</span> <span class="toc-text">安装 php-fpm</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-php-fpm"><span class="toc-number">3.2.2.</span> <span class="toc-text">配置 php-fpm</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8-php-fpm-%E5%92%8C%E8%AE%BE%E7%BD%AE%E5%BC%80%E6%9C%BA%E8%87%AA%E5%90%AF%E5%8A%A8"><span class="toc-number">3.2.3.</span> <span class="toc-text">启动 php-fpm 和设置开机自启动</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-Nginx-%E6%94%AF%E6%8C%81-PHP"><span class="toc-number">3.3.</span> <span class="toc-text">配置 Nginx 支持 PHP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95-PHP"><span class="toc-number">3.4.</span> <span class="toc-text">测试 PHP</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%89%E8%A3%85-phpMyAdmin"><span class="toc-number">4.</span> <span class="toc-text">安装 phpMyAdmin</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%E5%92%8C%E5%AE%89%E8%A3%85-phpMyAdmin"><span class="toc-number">4.1.</span> <span class="toc-text">下载和安装 phpMyAdmin</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BF%E9%97%AE-phpMyAdmin"><span class="toc-number">4.2.</span> <span class="toc-text">访问 phpMyAdmin</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE-cfg-%E2%80%98TempDir%E2%80%99-%E6%9D%83%E9%99%90"><span class="toc-number">4.3.</span> <span class="toc-text">配置 $cfg[‘TempDir’] 权限</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE-Cookie-%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81%E5%8A%A0%E5%AF%86%E5%AF%86%E7%A0%81"><span class="toc-number">4.4.</span> <span class="toc-text">设置 Cookie 身份验证加密密码</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%90%AF-phpMyAdmin-%E9%AB%98%E7%BA%A7%E5%8A%9F%E8%83%BD"><span class="toc-number">4.5.</span> <span class="toc-text">开启 phpMyAdmin 高级功能</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Nginx-%E5%92%8C-php-fpm-%E7%9A%84%E7%94%A8%E6%88%B7%E5%92%8C%E7%94%A8%E6%88%B7%E7%BB%84"><span class="toc-number">5.</span> <span class="toc-text">Nginx 和 php-fpm 的用户和用户组</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E7%94%A8%E6%88%B7%E5%92%8C%E7%94%A8%E6%88%B7%E7%BB%84"><span class="toc-number">5.1.</span> <span class="toc-text">修改用户和用户组</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E7%9B%AE%E5%BD%95%E6%9D%83%E9%99%90"><span class="toc-number">5.2.</span> <span class="toc-text">修改目录权限</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/post/c3b4/" title="Docker 使用宿主机网段"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Docker 使用宿主机网段"/></a><div class="content"><a class="title" href="/post/c3b4/" title="Docker 使用宿主机网段">Docker 使用宿主机网段</a><time datetime="2023-12-18T01:27:00.000Z" title="发表于 2023-12-18 09:27:00">2023-12-18</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 远程 SSH 终端登录显示器管理界面"/></a><div class="content"><a class="title" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面">ESXi 远程 SSH 终端登录显示器管理界面</a><time datetime="2023-11-29T01:45:00.000Z" title="发表于 2023-11-29 09:45:00">2023-11-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/9973/" title="ESXi 6.7 自动关机设置"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 6.7 自动关机设置"/></a><div class="content"><a class="title" href="/post/9973/" title="ESXi 6.7 自动关机设置">ESXi 6.7 自动关机设置</a><time datetime="2023-11-25T07:12:00.000Z" title="发表于 2023-11-25 15:12:00">2023-11-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 安装自带 Tailscale 和 ZeroTier"/></a><div class="content"><a class="title" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier">OpenWrt 安装自带 Tailscale 和 ZeroTier</a><time datetime="2023-11-21T01:19:00.000Z" title="发表于 2023-11-21 09:19:00">2023-11-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 更新所有已安装软件包"/></a><div class="content"><a class="title" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包">OpenWrt 更新所有已安装软件包</a><time datetime="2023-11-15T01:38:00.000Z" title="发表于 2023-11-15 09:38:00">2023-11-15</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 樵子</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/"><img class="icp-icon" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/icp.png"><span>渝ICP备19007019号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>